package aybolit.core.objects.model;

import javax.persistence.Entity;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Vadim
 * Date: 13.03.13
 * Time: 16:57
 * To change this template use File | Settings | File Templates.
 */
@Entity
public class Hospitales implements Serializable {
    private int hospitalId;

    @javax.persistence.Column(name = "hospital_id")
    @javax.persistence.Id
    public int getHospitalId() {
        return hospitalId;
    }

    public void setHospitalId(int hospitalId) {
        this.hospitalId = hospitalId;
    }

    private String name;

    @javax.persistence.Column(name = "name")
    @javax.persistence.Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String address;

    @javax.persistence.Column(name = "address")
    @javax.persistence.Basic
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    private String phone;

    @javax.persistence.Column(name = "phone")
    @javax.persistence.Basic
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    private String email;

    @javax.persistence.Column(name = "email")
    @javax.persistence.Basic
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    private int statusId;

    @javax.persistence.Column(name = "status_id")
    @javax.persistence.Basic
    public int getStatusId() {
        return statusId;
    }

    public void setStatusId(int statusId) {
        this.statusId = statusId;
    }

    private Timestamp timestamp;

    @javax.persistence.Column(name = "timestamp_")
    @javax.persistence.Basic
    public Timestamp getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Timestamp timestamp) {
        this.timestamp = timestamp;
    }

    private int deleted;

    @javax.persistence.Column(name = "deleted")
    @javax.persistence.Basic
    public int getDeleted() {
        return deleted;
    }

    public void setDeleted(int deleted) {
        this.deleted = deleted;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Hospitales that = (Hospitales) o;

        if (deleted != that.deleted) return false;
        if (hospitalId != that.hospitalId) return false;
        if (statusId != that.statusId) return false;
        if (address != null ? !address.equals(that.address) : that.address != null) return false;
        if (email != null ? !email.equals(that.email) : that.email != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (phone != null ? !phone.equals(that.phone) : that.phone != null) return false;
        if (timestamp != null ? !timestamp.equals(that.timestamp) : that.timestamp != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = hospitalId;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (address != null ? address.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + statusId;
        result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0);
        result = 31 * result + deleted;
        return result;
    }

    private Collection<Departments> departmentsesByHospitalId;

    @javax.persistence.OneToMany(mappedBy = "hospitalesByHospitalId")
    public Collection<Departments> getDepartmentsesByHospitalId() {
        return departmentsesByHospitalId;
    }

    public void setDepartmentsesByHospitalId(Collection<Departments> departmentsesByHospitalId) {
        this.departmentsesByHospitalId = departmentsesByHospitalId;
    }

    private Status statusByStatusId;

    @javax.persistence.ManyToOne
    public
    @javax.persistence.JoinColumn(name = "status_id", referencedColumnName = "status_id", table = "hospitales")
    Status getStatusByStatusId() {
        return statusByStatusId;
    }

    public void setStatusByStatusId(Status statusByStatusId) {
        this.statusByStatusId = statusByStatusId;
    }

    private Collection<Operators> operatorsesByHospitalId;

    @javax.persistence.OneToMany(mappedBy = "hospitalesByHospitalId")
    public Collection<Operators> getOperatorsesByHospitalId() {
        return operatorsesByHospitalId;
    }

    public void setOperatorsesByHospitalId(Collection<Operators> operatorsesByHospitalId) {
        this.operatorsesByHospitalId = operatorsesByHospitalId;
    }

    private Collection<Patientes> patientesesByHospitalId;

    @javax.persistence.OneToMany(mappedBy = "hospitalesByHospitalId")
    public Collection<Patientes> getPatientesesByHospitalId() {
        return patientesesByHospitalId;
    }

    public void setPatientesesByHospitalId(Collection<Patientes> patientesesByHospitalId) {
        this.patientesesByHospitalId = patientesesByHospitalId;
    }
}
